//
//  NSKVONotifying_Person.m
//  03-响应式编程思想
//
//  Created by J on 16/2/18.
//  Copyright © 2016年 J. All rights reserved.
//

#import "XMGKVONotifying_Person.h"
#import <objc/runtime.h>
@implementation XMGKVONotifying_Person

- (void)setAge:(NSInteger)age{
    [super setAge:age];
    //通知观察者,属性改变
    id observer = objc_getAssociatedObject(self, @"observer");

    //调用观察者发方法 通知观察者属性已经发生改变
    [observer observeValueForKeyPath:@"age" ofObject:self change:nil context:nil];


}

@end
